package main

import (
	"container/list"
	"fmt"
)

func main()  {
	l := list.New()
	l.PushBack(1)
	l.PushBack(2)
	l.PushBack(3)
	l.PushBack(4)

	fmt.Println("Before Removing ", l)
	var n *list.Element
	for e := l.Front(); e != nil; e = n {
		fmt.Println("remove ", e.Value)
		n = e.Next()
		l.Remove(e)
	}
	fmt.Println("After Removing ", l)

}
